package com.example.demo.Controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
//@ResponseBody
// 我们可以使用组合注解 @RestController 来代替上述两个注解，效果一样
@RestController
@RequestMapping("/user")
public class TestController {
    @RequestMapping("/sayhello")
    public String sayhello() {
        return "hello !!!good";
    }


    @RequestMapping("/method")
    public void method(String name,String pwd){
        System.out.println("name:" + name);
        System.out.println("pwd:" + pwd);
    }


    @RequestMapping("/m2")
    public Object method_2(UserInfo p){
        System.out.println("对象中的 name："+p.getName());
        System.out.println("对象中的 password："+p.getAge());
        return "/index.html";
    }
}


